package com.itany.ums.service;

import com.itany.ums.entity.User;
import com.itany.ums.exception.EmailEmptyException;
import com.itany.ums.exception.EmailExistsException;
import com.itany.ums.exception.PasswordEmptyException;
import com.itany.ums.exception.PasswordWrongException;
import com.itany.ums.exception.PhoneEmptyException;
import com.itany.ums.exception.PhoneExistsException;
import com.itany.ums.exception.PhoneNumWrongException;
import com.itany.ums.exception.UserLockedException;
import com.itany.ums.exception.EmailWrongException;
import com.itany.ums.exception.LoginnameEmptyException;
import com.itany.ums.exception.LoginnameOrPasswordWrongException;
import com.itany.ums.exception.UsernameEmptyException;
import com.itany.ums.exception.UsernameExistsException;
import com.itany.ums.vo.Result;
import com.itany.ums.vo.UserVo;

// 在service层的接口中定义service有哪些功能是可以被action使用的
public interface UserService {

	// 处理登录功能相关业务逻辑的
	User login(String loginname, String password) throws LoginnameEmptyException, PasswordEmptyException, LoginnameOrPasswordWrongException, UserLockedException;

	// 当方法参数大于3个时, 建议考虑将数据封装成对象传递
	/**
	 * 处理注册功能相关业务
	 * @param vo 包含了注册信息的对象
	 * @throws UsernameEmptyException 当用户名为空时, 抛出此异常
	 * @throws PhoneNumWrongException 当手机号码不符合要求时, 抛出此异常
	 * @throws PasswordEmptyException 当密码为空时, 抛出此异常
	 * @throws PasswordWrongException 当两次密码不一致时, 抛出此异常
	 * @throws PhoneEmptyException 当手机号码为空时, 抛出此异常
	 * @throws EmailEmptyException 当邮箱为空时, 抛出此异常
	 * @throws EmailWrongException 当手机号码格式不正确时, 抛出此异常
	 * @throws UsernameExistsException 当用户名已被使用时, 抛出此异常
	 * @throws PhoneExistsException 当手机号码已被使用时, 抛出此异常
	 * @throws EmailExistsException 当邮箱已被使用时, 抛出此异常
	 */
	void register(UserVo vo) throws UsernameEmptyException, PhoneNumWrongException, PasswordEmptyException, PasswordWrongException, PhoneEmptyException, EmailEmptyException, EmailWrongException, UsernameExistsException, PhoneExistsException, EmailExistsException;

	Result modifyPwd(long id, String newPwd);

	Result modifyUsername(long id, String username);

	User[] findAllNormal();

	Result modifyUserState(long id);

}
